# 注解
import json
import random
from typing import Union

# 基础数据类型注解
age: int = 10

var_2: str = "liuhaope"


class Student:
    pass


stu: Student = Student()

# 基础容器类型注解
my_list: list = [1, 2, 3]
my_tuple: tuple = (1, 2, 3)

my_dict: dict = {"liu": 23}

# 容器类型详细注解
my_list1: list[int] = [1, 2, 3]
my_tuple1: tuple[int, str, bool] = (1, "123", True)

my_dict1: dict[str, int] = {"liu": 23}

# 在注释中进行类型注解
var_1 = random.randint(1, 10)  # type: int
var_3 = json.load('{"name":"zhangsan"}')  # type:dict[str,str]


# 类型注解


# 形参注解
def function(x: int, y: int) -> int:
    return x + y


#UNION
my_list2: list[Union[str,str]] = [1,2,'a','b']

my_dict2: dict[Union[str,int]] = {"name":"zhou","age":13}


